<nz-table
  #expandTable
  nzSize="small"
  [nzData]="treeData"
  nzTableLayout="fixed"
  [nzShowTotal]="totalTemplate"
  [nzShowPagination]="false"
  [nzTotal]="total"
>
  <ng-template #totalTemplate let-total>共 {{ total }} 条</ng-template>
  <thead>
  <tr>
    <ng-container *ngFor="let col of columns">
      <th [nzWidth]="col.width ? col.width + 'px' : '100px'">{{ col.title }}</th>
    </ng-container>
    <th *ngIf="lineBtnGroup.length > 0" [nzWidth]="lineBtnWidth + 'px'" nzRight="0px" nzAlign="center">操作</th>
  </tr>
  </thead>
  <tbody>
  <ng-container *ngFor="let data of expandTable.data">
    <ng-container *ngFor="let item of mapOfExpandedData[data.id]">
      <tr *ngIf="(item.parent && item.parent.expand) || !item.parent"
          (click)="onRowClick(item)"
          [ngStyle]="{'background-color': colorOfExpandedData[item.id]}"
      >
        <ng-container *ngFor="let col of columns; index as idx">
          <td
            *ngIf="idx == 0"
            [nzIndentSize]="item.level! * 20"
            [nzShowExpand]="!!item.children"
            [(nzExpand)]="item.expand"
            (nzExpandChange)="collapse(mapOfExpandedData[data.id], item, $event)"
            [ngStyle]="{'color': parent == 'evl020' && (item.indexResultDetailList == null || item.indexResultDetailList.length == 0) ? 'red' : ''}"
          >
            {{ item[col.item] }}
          </td>
          <td *ngIf="idx > 0">
            <label style="word-break: break-all">{{ item[col.item] }}</label>
          </td>
        </ng-container>
        <td *ngIf="lineBtnGroup.length > 0" nzRight="0px" nzAlign="center">
          <ng-container *ngFor="let btn of lineBtnGroup; index as i">
            <ng-container [ngSwitch]="btn?.type?.name">
              <a *ngSwitchCase="'icon'" (click)="onLineBtnClick(btn, item)">
                <i nz-icon [nzType]="btn?.type?.iconType" style="font-size: 28px"></i>
              </a>
              <ng-container *ngSwitchDefault>
                <a *ngIf="lineBtnGroup.length > 1 && i < lineBtnGroup.length - 1; else lineBtnElse"
                   (click)="onLineBtnClick(btn, item)">{{ btn.title + ' ' }}</a>
                <ng-template #lineBtnElse>
                  <a (click)="onLineBtnClick(btn, item)">{{ btn.title + '' }}</a>
                </ng-template>
              </ng-container>
            </ng-container>
          </ng-container>
        </td>
      </tr>
    </ng-container>
  </ng-container>
  </tbody>
</nz-table>
